/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.hugo.senai.view;

import br.com.hugo.senai.classes.Configuracoes;
import br.com.hugo.senai.entities.Conteudo;
import br.com.hugo.senai.entities.Curso;
import br.com.hugo.senai.dao.Hibernate;
import br.com.hugo.senai.entities.Disciplina;
import br.com.hugo.senai.entities.Questao;
import br.com.hugo.senai.entities.Usuario;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Administrador
 */
public class Menu extends javax.swing.JFrame {

    /**
     * Creates new form Menu
     */
    public Menu() {

        initComponents();
        this.setExtendedState(Menu.MAXIMIZED_BOTH);
        fundo.setBackground(Color.WHITE);
        this.getContentPane().setBackground(Color.WHITE);

        System.out.println(Usuario.adm);
        System.out.println(Usuario.nomeUsuario);

        if (Usuario.adm == false) {
            jMenu2.setEnabled(false);
        }

        List<Curso> cursos = Hibernate.listAll(Curso.class);

        lista.setListData(cursos.toArray());

        List<Curso> cursosEscolhidos = new ArrayList<>();

        cbQuestaoCurso.removeAllItems();

        for (Curso curso : cursos) {
            cbQuestaoCurso.addItem(curso);
        }

        this.setIconImage(new Configuracoes().SYSTEM_ICON);

        super.setTitle(new Configuracoes().SYSTEM_NAME);

//        
//        for (Questao questao: questoes){
//            tableModel.addRow(new Object[]{questao.getEnunciado(), questao.getResposta(), questao.isAlternativa(), questao.isProvao()});
//        }
//        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pmTabela = new javax.swing.JPopupMenu();
        miExibir = new javax.swing.JMenuItem();
        mAdd = new javax.swing.JMenuItem();
        mExcluir = new javax.swing.JMenuItem();
        mEditar = new javax.swing.JMenuItem();
        jScrollPane3 = new javax.swing.JScrollPane();
        fundo = new javax.swing.JPanel();
        cbQuestaoConteudo = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        cbQuestaoMateria = new javax.swing.JComboBox();
        jButton1 = new javax.swing.JButton();
        cbQuestaoCurso = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        tQuestoes = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        lista = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();

        miExibir.setText("Exibir questão");
        miExibir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miExibirActionPerformed(evt);
            }
        });
        pmTabela.add(miExibir);

        mAdd.setText("Adicionar a prova");
        mAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mAddActionPerformed(evt);
            }
        });
        pmTabela.add(mAdd);

        mExcluir.setText("Excluir questão");
        mExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mExcluirActionPerformed(evt);
            }
        });
        pmTabela.add(mExcluir);

        mEditar.setText("Editar");
        mEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mEditarActionPerformed(evt);
            }
        });
        pmTabela.add(mEditar);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setBackground(new java.awt.Color(255, 204, 51));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        cbQuestaoConteudo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cbQuestaoConteudoMouseClicked(evt);
            }
        });
        cbQuestaoConteudo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbQuestaoConteudoActionPerformed(evt);
            }
        });

        jLabel9.setText("CONTEÚDO:");

        jLabel8.setText("DISCIPLINA:");

        jLabel7.setText("CURSO:");

        cbQuestaoMateria.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cbQuestaoMateriaMouseClicked(evt);
            }
        });
        cbQuestaoMateria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbQuestaoMateriaActionPerformed(evt);
            }
        });

        jButton1.setText("PESQUISAR");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        cbQuestaoCurso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbQuestaoCursoActionPerformed(evt);
            }
        });

        tQuestoes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "id", "Enunciado", "Resposta", "Objetivo", "Alternativa", "Provão"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tQuestoes.getTableHeader().setReorderingAllowed(false);
        tQuestoes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tQuestoesMouseClicked(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                tQuestoesMouseReleased(evt);
            }
        });
        jScrollPane1.setViewportView(tQuestoes);
        if (tQuestoes.getColumnModel().getColumnCount() > 0) {
            tQuestoes.getColumnModel().getColumn(0).setMinWidth(0);
            tQuestoes.getColumnModel().getColumn(0).setPreferredWidth(0);
            tQuestoes.getColumnModel().getColumn(0).setMaxWidth(0);
            tQuestoes.getColumnModel().getColumn(1).setResizable(false);
            tQuestoes.getColumnModel().getColumn(2).setResizable(false);
            tQuestoes.getColumnModel().getColumn(3).setResizable(false);
            tQuestoes.getColumnModel().getColumn(4).setResizable(false);
            tQuestoes.getColumnModel().getColumn(5).setResizable(false);
        }

        lista.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(lista);

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        jLabel1.setText("BANCO DE QUESTÕES");

        javax.swing.GroupLayout fundoLayout = new javax.swing.GroupLayout(fundo);
        fundo.setLayout(fundoLayout);
        fundoLayout.setHorizontalGroup(
            fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fundoLayout.createSequentialGroup()
                .addGap(51, 51, 51)
                .addGroup(fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(fundoLayout.createSequentialGroup()
                        .addGroup(fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane1)
                            .addGroup(fundoLayout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cbQuestaoCurso, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cbQuestaoMateria, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cbQuestaoConteudo, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(883, Short.MAX_VALUE))
        );
        fundoLayout.setVerticalGroup(
            fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, fundoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(5, 5, 5)
                .addGroup(fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(cbQuestaoCurso, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(cbQuestaoMateria, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(cbQuestaoConteudo, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(fundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane2)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE))
                .addContainerGap(121, Short.MAX_VALUE))
        );

        jScrollPane3.setViewportView(fundo);

        jMenu1.setText("Arquivo");

        jMenuItem2.setText("Sair");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Ferramentas");

        jMenuItem1.setText("Cadastrar Usuário");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuItem4.setText("Cadastrar Curso");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem4);

        jMenuItem5.setText("Cadastrar Disciplina");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        jMenuItem6.setText("Cadastrar Conteúdo");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem6);

        jMenuItem3.setText("Cadastrar Questão");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuItem7.setText("Criar prova");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem7);

        jMenuItem8.setText("Cadastrar turma");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem8);

        jMenuItem9.setText("Adicionar questão");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem9);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 1026, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
        );

        setSize(new java.awt.Dimension(1042, 520));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        new CadastroUsuario().setVisible(true);


    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        dispose();
        new Login().setVisible(true);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        //dispose();
        new CadastroQuestao().setVisible(true);

    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed

        new CadastroCurso().setVisible(true);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        //dispose();
        new CadastroDisciplina().setVisible(true);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void cbQuestaoCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbQuestaoCursoActionPerformed
        cbQuestaoMateria.removeAllItems();

        List<Disciplina> materias = Hibernate.listAll(Disciplina.class, (Curso) cbQuestaoCurso.getSelectedItem(), "curso");

        for (Disciplina materia : materias) {
            cbQuestaoMateria.addItem(materia);
        }
    }//GEN-LAST:event_cbQuestaoCursoActionPerformed

    private void cbQuestaoMateriaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cbQuestaoMateriaMouseClicked

    }//GEN-LAST:event_cbQuestaoMateriaMouseClicked

    private void cbQuestaoMateriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbQuestaoMateriaActionPerformed
        cbQuestaoConteudo.removeAllItems();

        List<Conteudo> conteudos = Hibernate.listAll(Conteudo.class, (Disciplina) cbQuestaoMateria.getSelectedItem(), "disciplina");

        for (Conteudo conteudo : conteudos) {
            cbQuestaoConteudo.addItem(conteudo);
        }
    }//GEN-LAST:event_cbQuestaoMateriaActionPerformed

    private void cbQuestaoConteudoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbQuestaoConteudoActionPerformed

    }//GEN-LAST:event_cbQuestaoConteudoActionPerformed

    private void tQuestoesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tQuestoesMouseReleased

        if (evt.isPopupTrigger() && tQuestoes.getSelectedRowCount() > 0) {
            tQuestoes.setColumnSelectionInterval(0, 4);

            pmTabela.show(evt.getComponent(), evt.getX(), evt.getY());
        }

    }//GEN-LAST:event_tQuestoesMouseReleased
    public static int idQuestao;
    private void miExibirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miExibirActionPerformed

        //idQuestao = (int) tQuestoes.getValueAt(tQuestoes.getSelectedRow(), 0);
        new CadastroQuestao().setVisible(true);


    }//GEN-LAST:event_miExibirActionPerformed

    private void cbQuestaoConteudoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cbQuestaoConteudoMouseClicked

    }//GEN-LAST:event_cbQuestaoConteudoMouseClicked
    public void atualizarQuestoesDoConteudo() {
        Conteudo c = (Conteudo) cbQuestaoConteudo.getSelectedItem();

        List<Questao> questoes = Hibernate.listByQuestion(c.getId());
        DefaultTableModel tableModel = (DefaultTableModel) tQuestoes.getModel();

        tableModel.setNumRows(0);

        for (Questao questao : questoes) {
            tableModel.addRow(new Object[]{questao.getId(), questao.getEnunciado(),
                questao.getResposta(), questao.getObjetivo(), questao.isAlternativa(), questao.isProvao()});
        }
    }
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        atualizarQuestoesDoConteudo();

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        // dispose();
        new CadastroConteudo().setVisible(true);
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void mAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mAddActionPerformed

    }//GEN-LAST:event_mAddActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        new CadastroProva().setVisible(true);


    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        new CadastroTurma().setVisible(true);
    }//GEN-LAST:event_jMenuItem8ActionPerformed
    public static int idQuestaoParaCopia;
    private void tQuestoesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tQuestoesMouseClicked
        if (tQuestoes.getSelectedRowCount() > 0) {
            if (evt.getClickCount() == 2) {
                idQuestaoParaCopia = (int) tQuestoes.getValueAt(tQuestoes.getSelectedRow(), 0);
                new CopiaQuestao().setVisible(true);
            }

        }


    }//GEN-LAST:event_tQuestoesMouseClicked

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed

        new Login().setVisible(true);
    }//GEN-LAST:event_formWindowClosed

    private void listaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaMouseClicked
        if (evt.getClickCount() == 2 && lista.getSelectedValue() != null) {

            Curso c = (Curso) lista.getSelectedValue();
            JOptionPane.showMessageDialog(null, c.getId() + " " + c.getCargaHoraria());
        }
    }//GEN-LAST:event_listaMouseClicked

    private void mExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mExcluirActionPerformed

        if (tQuestoes.getSelectedRowCount() > 0) {
            Questao q = (Questao) Hibernate.get(Questao.class, (int) tQuestoes.getValueAt(tQuestoes.getSelectedRow(), 0));
            Hibernate.delete(q);

            atualizarQuestoesDoConteudo();
        }
    }//GEN-LAST:event_mExcluirActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
        new AddQuestao().setVisible(true);
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void mEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mEditarActionPerformed
        
        idQuestao = (int) tQuestoes.getValueAt(tQuestoes.getSelectedRow(), 0);
        new EditarQuestao().setVisible(true);


    }//GEN-LAST:event_mEditarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Menu().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cbQuestaoConteudo;
    private javax.swing.JComboBox cbQuestaoCurso;
    private javax.swing.JComboBox cbQuestaoMateria;
    private javax.swing.JPanel fundo;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JList lista;
    private javax.swing.JMenuItem mAdd;
    private javax.swing.JMenuItem mEditar;
    private javax.swing.JMenuItem mExcluir;
    private javax.swing.JMenuItem miExibir;
    private javax.swing.JPopupMenu pmTabela;
    private javax.swing.JTable tQuestoes;
    // End of variables declaration//GEN-END:variables
}
